package lab02.test21;

/**
 * Created by MECHREV on 2017/11/1.
 */
import java.util.HashMap;
public class Test {
    public static void main(String[] args) {
        String sentence="nihaoaahaha";
        HashMap<Character,Integer>Hashmap=new HashMap<Character,Integer>();
        for(int i=0;i<sentence.length();i++){
            Character a=sentence.charAt(i);
            if (null==Hashmap.get(a)){
                Hashmap.put(a,1);
            }
            else {
                Hashmap.put(a,Hashmap.get(a)+1);
            }
        }
        for (Character key:Hashmap.keySet()){
            System.out.println(key+"="+Hashmap.get(key));
        }
    }
}
